import java.util.Scanner;

public class Lanqiao_3_7_leiqu {
    public static void main(String[] args) {
        int num,x,y,xx,l,r;
        int temp = 0;
        char[] a = new char[39];
        char[] b = new char[39];
            for (int i = 0; i < 39; i++) {
                b[i] = ' ';
            }
        Scanner sc = new Scanner(System.in);
        num = sc.nextInt();
        int[] ax = new int[num];
        int[] ay = new int[num];
        for (int i =0;i<num;i++) {
            ax[i] = sc.nextInt();
            ay[i] = sc.nextInt();
        }
        for (;num>0;num--){
            x = ax[temp];
            y = ay[temp];
            xx = ax[temp];
            temp++;
            l = 0;r = x-1;
            for (int i = 0; i < 39; i++) {
                b[i] = ' ';
            }
            b[0] = 'X';
            b[r] = 'X';
            for (;y>0 ; y--) {
                int t = x;
                int tl = l;
                int tr = r;
                for (; t>1 ; t--){
                    for (int i = 0; i < 39; i++) {
                        a[i] = ' ';
                    }
                    a[tl] = 'X';
                    a[tr] = 'X';
                    tl++;
                    tr--;
                    for (int i = 0; i < 39; i++) {
                        System.out.print(a[i]);
                        if (a[i]=='X'){
                            if (t==(xx/2)+1){
                                break;
                            }
                            for (int j = i+1;j<39;j++){
                                System.out.print(a[j]);
                                if (a[j]=='X')
                                    break;
                            }
                            break;
                        }
                    }
                    System.out.println();
                }
            }
            System.out.print(b[0]);
            for (int i = 1; i < 39; i++) {
                System.out.print(b[i]);
                if (b[i]=='X')
                    break;
                }
            if(num!=1){
                System.out.println();
                System.out.println();
            }
        }
    }
}
